package com.jz.community.moduleshopping.refund.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jz.community.basecomm.glideConfig.GlideApp;
import com.jz.community.moduleshopping.R;
import com.jz.community.moduleshopping.orderDetail.bean.OrderDetailBean;

import java.util.List;

public class RefundDetailGoodsAdapter extends BaseQuickAdapter<OrderDetailBean.OrderItemListBean, BaseViewHolder> {

    public RefundDetailGoodsAdapter(int layoutResId, @Nullable List<OrderDetailBean.OrderItemListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OrderDetailBean.OrderItemListBean item) {
        ImageView refund_img = helper.getView(R.id.refund_img);
        GlideApp.with(mContext)
                .load(item.getGoodsImg())
                .placeholder(R.mipmap.image_default)
                .error(R.mipmap.image_default)
                .into(refund_img);
        TextView refund_name = helper.getView(R.id.refund_name);
        TextView refund_num = helper.getView(R.id.refund_num);
        refund_num.setText(item.getGoodsCount());
        refund_name.setText(item.getGoodsName());
        TextView refund_standard = helper.getView(R.id.refund_standard);
        refund_standard.setText(item.getSkuName());
        TextView refund_price = helper.getView(R.id.refund_price);
        if (!TextUtils.isEmpty(item.getDiscountPrice())) {
            refund_price.setText("¥" + item.getDiscountPrice());
        } else {
            refund_price.setText("¥" + item.getPrice());
        }
    }
}
